//
//  QSMineCell.m
//  DigitalEconomy_iOS
//
//  Created by Ding on 2020/5/18.
//  Copyright © 2020 DingC. All rights reserved.
//

#import "QSMineCell.h"

@implementation QSMineCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    [self congigSubView];
}

- (void)congigSubView{
    self.layer.cornerRadius = 5;
    self.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    self.companyNumLabel.layer.cornerRadius = 5;
    self.companyNumLabel.layer.masksToBounds = YES;
}


- (void)setModel:(QSMineCellModel *)model{
    _model = model;
//    self.leftImageView.image = model.leftImage;
    self.typeLabel.text = model.leftText;
    if ([model.leftText isEqualToString:@"我关联的企业"]) {
        self.leftImageView.image = [UIImage imageNamed:@"ic_mine_myEnterprise"];
        if (!self.companyNum || self.companyNum == 0) {
            self.companyNumLabel.hidden = YES;
        }else{
            self.companyNumLabel.hidden = NO;
            if (self.companyNum >= 100) {
                self.companyNumLabel.text = @"···";
            }else{
                
                self.companyNumLabel.text = [NSString stringWithFormat:@"%ld", self.companyNum];
            }
        }
    }
    if ([model.leftText isEqualToString:@"我的企业服务报告"]) {
        self.leftImageView.image = [UIImage imageNamed:@"ic_mine_servicereport"];
    }
    if ([model.leftText isEqualToString:@"分享"]) {
        self.leftImageView.image = [UIImage imageNamed:@"ic_mine_share"];
    }
    if ([model.leftText isEqualToString:@"系统设置"]) {
        self.leftImageView.image = [UIImage imageNamed:@"ic_mine_set"];
    }
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
